package com.chance.cc.crawler.development.command.trigger.domain.xhs;

import com.chance.cc.crawler.core.downloader.HttpPage;
import com.chance.cc.crawler.development.command.job.domain.xhs.XHSPSearchLowCrawlerScheduleJob;
import com.chance.cc.crawler.development.command.trigger.CrawlerJobTriggerCommand;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;
import org.apache.commons.lang3.StringUtils;

import static com.chance.cc.crawler.development.command.publish.douyin.DYPublishCrawlerJob.metaServerIP;
import static com.chance.cc.crawler.development.command.publish.douyin.DYPublishCrawlerJob.metaServerPort;

/**
 * @author bx
 * @date 2020/12/7 0007 11:15
 */
public class XHSPSearchLowScheduleTrigger {


    private static final String crawlerKey = XHSPSearchLowCrawlerScheduleJob.crawlerKey;
    public static final String tringgerKey =
            StringUtils.joinWith("-", crawlerKey,
                    CrawlerMetaConstant.ScheduleJobTrigger_Simple);

    private static CrawlerJobTriggerCommand crawlerJobTriggerCommand =
            new CrawlerJobTriggerCommand(metaServerIP,metaServerPort);

    public static void main(String[] args) {
        publishSearchScheduleTriggerInfo();
    }


    public static void publishSearchScheduleTriggerInfo(){
        HttpPage page = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                tringgerKey,
                XHSPSearchLowCrawlerScheduleJob.domainId,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 17 0 * * ?",
                "小红书搜索视频评论任务调度");
        System.out.println("添加手机调度： "+page.getRawText());
    }
}
